package com.anhndt.smslater.fragmentManager;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.anhndt.autosms.R;
import com.anhndt.smslater.fragment.CateScreen;
import com.anhndt.smslater.fragment.TestFragment;

public class MainViewAdapter extends FragmentPagerAdapter {

	// private static final String[] CONTENT = new String[] { "Chuyên mục",

	private static String[] CONTENT = new String[4];
	private Context mContext;

	public MainViewAdapter(Context _context, FragmentManager fm) {
		super(fm);
		mContext = _context;
		CONTENT[0] = mContext.getString(R.string.title_tab_new_action);
		CONTENT[1] = mContext.getString(R.string.title_tab_waiting);
		CONTENT[2] = mContext.getString(R.string.title_tab_sended);
		CONTENT[3] = mContext.getString(R.string.title_tab_info);

	}

	@Override
	public Fragment getItem(int position) {
		switch (position) {
		case 0:
			return Fragment.instantiate(mContext, CateScreen.class.getName());
		case 1:
			return Fragment.instantiate(mContext, CateScreen.class.getName());

		case 2:
			return Fragment.instantiate(mContext, CateScreen.class.getName());

		default:
			return TestFragment.newInstance(CONTENT[position % CONTENT.length]);
		}
	}

	@Override
	public CharSequence getPageTitle(int position) {

		return CONTENT[position % CONTENT.length];

	}

	@Override
	public int getCount() {
		return CONTENT.length;
	}

}
